/**
 * <p>功能:系统管理模块-权限管理-权限管理 <p>
 * @extends Wys.basic.BaseView
 * @author wys
 */
Ext.define('Jason.view.protal.module.systemManager.right.rights.MainView', {
    extend: 'Ext.container.Container',
    xtype: 'systemManager_rights_usersView',
    style: 'background:#f1f4f8;',
    requires: [
        'Ext.panel.Panel',
        'Ext.grid.feature.Grouping',
        'Wys.form.field.SearchField',
        'Wys.filter.UseFilter',
        'Wys.combobox.ComboTree',
        'Wys.utils.Config',
        'Wys.button.Refresh',
        'Wys.form.BaseWindow',
        'Ext.button.Button',
        'Jason.store.protal.module.systemManager.sources.menus.TreeStore',
        'Jason.store.protal.module.systemManager.right.rights.RightStore',
        'Jason.view.protal.module.systemManager.right.rights.MainCtrl',
        'Jason.view.protal.module.systemManager.right.rights.ViewModel'
    ],
    controller: 'right_rights_MainViewCtrl',
    viewModel: { type: 'rights_MainViewModel' },
    layout: {
        type: 'hbox',
        align: 'stretch'
    },
    items: [
        {
            cls: 'faq-left-sidebar shadow-panel',
            xtype: 'treepanel',
            border: true,
            title: '数据结构',
            reserveScrollbar: true,
            useArrows: true,
            rootVisible: false,
            multiSelect: true,
            singleExpand: true,
            tools: [{
                type: 'expand',
                tooltip: I18N.expandText,
                handler: function (exp, e, header) {
                    header.up('treepanel').expandAll();
                }
            }, {
                type: 'collapse',
                tooltip: I18N.collapseText,
                handler: function (exp, e, header) {
                    header.up('treepanel').collapseAll();
                }
            }, {
                type: 'refresh',
                tooltip: '点击刷新数据结构',
                listeners: {
                    click: 'refreshLeftMenuTree'
                }
            }],
            listeners: {
                itemclick: 'onTreeNodeClick'
            },
            bind: '{leftMenuTreeStore}',
            iconCls: 'x-fa fa-sitemap',
            ui: 'light', width: 230
        },
        {
            xtype: 'baseView',
            ui: 'light',
            itemId: 'rightsView',
            enabledMark: false,
            margin: '0 0 0 6',
            flex: 1,
            selType: 'checkboxmodel',
            multiSelect: true,
            dockedItems: [{
                xtype: 'toolbar',
                dock: 'top',
                items: [{
                    xtype: 'gridsearchfield',
                    paramName: 'rightname'
                }, {
                    xtype: 'segmentedbutton',
                    items: [{
                        xtype: 'newbutton',
                        rightCode: 'RIGHTMANAGER'
                    }, {
                        xtype: 'editbutton',
                        rightCode: 'RIGHTMANAGER'
                    }, {
                        xtype: 'deletebutton',
                        rightCode: 'RIGHTMANAGER'
                    }]
                }, '->', {
                    xtype: 'refresh',
                    rightCode: 'RIGHTMANAGER',
                    viewItemId: '#rightsView'
                }]
            }, {
                xtype: 'pagingtoolbar',
                bind: '{rightRightStore}',
                dock: 'bottom'
            }],
            bind: '{rightRightStore}',
            listeners: {
                itemdblclick: 'onEditButtonClick'
            },
            columns: [
                { xtype: 'rownumberer', text: '序号', align: 'center', width: 50 },
                { text: '资源代码', dataIndex: 'sourcescode', hidden: true, menuDisabled: true, align: 'center', flex: .3, minWidth: 140 },
                {
                    text: '资源名称', dataIndex: 'modularname', menuDisabled: true, align: 'center', flex: .2, minWidth: 100, renderer: function (v, mate) {
                        mate.style = "font-weight:bold;";
                        return v;
                    }
                },
                { text: '权限名称', dataIndex: 'rightname', menuDisabled: true, align: 'center', flex: .4, minWidth: 160 },
                { text: '权限标识', dataIndex: 'rightcode', flex: 1, hidden: true, minWidth: 140 },
                { text: '编辑人', dataIndex: 'creater', width: 100 },
                { text: '创建日期', dataIndex: 'createDate', width: 135, xtype: 'datecolumn', format: 'Y-m-d H:i' }
            ]
        }
    ]
});